NProgress.start();
window.onload = function () {
    NProgress.done();
}
layui.use(['element', 'form', 'jquery'], function () {
    var element = layui.element;
    var form = layui.form;
    var $ = layui.jquery;
    form.on('submit(add)', function (data) {
        $.post("/system/role/save", data.field, function (res) {
            if (res.success) {
                layer.msg("添加成功！", {icon: 6, time: 700, anim: 4}, function () {
                    parent.layui.reload({});
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                });
            } else {
                parent.layer.alert(res.data.errMsg);
            }
        }, 'json');
        return false;
    });
});